package com.wisewin.pose.util.wechatOffice.config;

import com.wisewin.pose.util.wechat.WechatOfficeUtil;
import com.wisewin.pose.util.wechatOffice.WechatApi;
import com.wisewin.pose.util.wechatOffice.WxMsgCrypt;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


@Configuration
public class WechatConfig {

    @Autowired
    OfficeProperties officeProperties;

    @Bean
    public WechatApi getWechatApi(){
        WechatApi wechatApi=new WechatApi(officeProperties.getAppId(),officeProperties.getAppSecret());
        return wechatApi;
    }

    @Bean
    public WxMsgCrypt getWxMsgCrypt(){
        WxMsgCrypt wxMsgCrypt=new WxMsgCrypt(
                officeProperties.getAppId(),
                officeProperties.getToken(),
                officeProperties.getEncodingAESKey());
        return wxMsgCrypt;
    }

    @Bean
    public WechatOfficeUtil getWechatOfficeUtil(){
        WechatOfficeUtil wechatOfficeUtil = new WechatOfficeUtil(officeProperties.getAppId(),officeProperties.getAppSecret());
        return wechatOfficeUtil;
    }
}
